package com.dlc.shop.bean.enums;

import com.dlc.shop.common.i18n.I18nMessage;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;


/**
 * excel错误信息参数
 * @author gaozijie
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
public class ExcelErrorParam {
    /**
     * 行号
     */
    private Integer rowNum;
    /**
     * 错误类型
     */
    private Integer errorType;
    /**
     * 错误参数
     */
    private String data;
    /**
     * 错误原因
     */
    private String errorReason;
    /**
     * 错误信息
     */
    private String errorMsg;

    public ExcelErrorParam(Integer rowNum, Integer errorType, String data, String errorReason) {
        this.rowNum = rowNum;
        this.errorType = errorType;
        this.data = data;
        this.errorReason = errorReason;
    }

    public String getErrorMsg() {
        errorMsg = String.format(I18nMessage.getMessage("yami.param.error"), rowNum, this.errorReason);
        return errorMsg;
    }
}
